package org.idea.spring.dependency.inject.setter;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * 基于xml的依赖注入方式案例
 *
 * @Author linhao
 * @Date created in 8:29 上午 2021/4/20
 */
public class InDependencyInjectDemo {

    public static void main(String[] args) {
        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);
        String xmlPath = "classpath:/META-INF/independency-inject.xml";
        xmlBeanDefinitionReader.loadBeanDefinitions(xmlPath);
        PersonHolder personHolder = beanFactory.getBean(PersonHolder.class);
        System.out.println(personHolder);
    }
}
